package com.ruoyi.whole.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.AutofillUtil;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.fund.domain.DmsFund;
import com.ruoyi.fund.mapper.DmsFundMapper;
import com.ruoyi.fund.service.IDmsFundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 资金账户Service业务层处理
 *
 * @author liuchuanfa
 * @date 2024-03-06
 */
@Service
public class DmsFundServiceImpl extends ServiceImpl<DmsFundMapper, DmsFund> implements IDmsFundService
{
    @Autowired
    private DmsFundMapper dmsFundMapper;
    @Autowired
    private AutofillUtil autofillUtil;

    /**
     * 查询资金账户
     *
     * @param id 资金账户主键
     * @return 资金账户
     */
    @Override
    public DmsFund selectDmsFundById(Long id)
    {
        return dmsFundMapper.selectDmsFundById(id);
    }

    /**
     * 查询资金账户列表
     *
     * @param dmsFund 资金账户
     * @return 资金账户
     */
    @Override
    public List<DmsFund> selectDmsFundList(DmsFund dmsFund)
    {
        return dmsFundMapper.selectDmsFundList(dmsFund);
    }

    /**
     * 新增资金账户
     *
     * @param dmsFund 资金账户
     * @return 结果
     */
    @Override
    public int insertDmsFund(DmsFund dmsFund)
    {
        //新增自动填充
        autofillUtil.autoFillCreate(dmsFund);
        return dmsFundMapper.insertDmsFund(dmsFund);
    }

    /**
     * 修改资金账户
     *
     * @param dmsFund 资金账户
     * @return 结果
     */
    @Override
    public int updateDmsFund(DmsFund dmsFund)
    {
        dmsFund.setUpdateTime(DateUtils.getNowDate());
        return dmsFundMapper.updateDmsFund(dmsFund);
    }

    /**
     * 批量删除资金账户
     *
     * @param ids 需要删除的资金账户主键
     * @return 结果
     */
    @Override
    public int deleteDmsFundByIds(Long[] ids)
    {
        return dmsFundMapper.deleteDmsFundByIds(ids);
    }

    /**
     * 删除资金账户信息
     *
     * @param id 资金账户主键
     * @return 结果
     */
    @Override
    public int deleteDmsFundById(Long id)
    {
        return dmsFundMapper.deleteDmsFundById(id);
    }
}
